let myAjax = new XMLHttpRequest() || new ActiveXObject('Microsoft.XMLHTTP')
function loadPage() {
    myAjax.open('get', 'http://localhost:3000/report/new', true)
    myAjax.send()
    myAjax.onreadystatechange = function() {
        if(myAjax.readyState == 4 && myAjax.status == 200) {
            let res = JSON.parse(myAjax.responseText)
            console.log(res)
            showReport(res, 'new')
        }else{
        }
    }
}
loadPage()
function showReport(data, dom) {
    let nCon = document.querySelector('.nCon')
    for(let i = 0; i < data.length; i++) {
        let li = document.createElement('li')
        let p = document.createElement('p')
        let span = document.createElement('span')
        let span1 = document.createElement('span')
        let span2 = document.createElement('span')
        let span3 = document.createElement('span')
        let span4 = document.createElement('span')
        let img = document.createElement('img')
        let img1 = document.createElement('img')
        let img2 = document.createElement('img')

        img.src = data[i].img
        p.innerText = data[i].text
        span.innerText = data[i].uName
        span1.style.marginLeft = '600px'
        img1.src = '../img/css/img/xin.png'
        span2.innerText = '3'
        img2.src = '../img/css/img/reply.png'
        span4.innerText = '5'

        li.className = 'item'
        li.appendChild(img)
        li.appendChild(p)
        li.appendChild(span)
        span1.appendChild(img1)
        li.appendChild(span1)
        li.appendChild(span2)
        span3.appendChild(img2)
        li.appendChild(span3)
        li.appendChild(span4)
        nCon.appendChild(li)
    }
}